<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAfterSaleOrderSkusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('after_sale_order_skus', function (Blueprint $table) {
            $table->id();
            $table->bigInteger('after_sale_order_id')->index()->comment('售后订单 ID');
            $table->bigInteger('order_id')->comment('订单 ID');
            $table->bigInteger('commodity_id')->comment('商品 ID');
            $table->bigInteger('commodity_activity_id')->comment('商品活动 ID');
            $table->bigInteger('commodity_activity_sku_id')->comment('商品活动 SKU ID');
            $table->integer('amount')->comment('商品件数');
            $table->unsignedBigInteger('unit_price')->default(0)->comment('单价');
            $table->text('sku_snapshot')->comment('sku 数据快照');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('after_sale_order_skus');
    }
}
